public class SingleNumber {
    // leetcode 只出现一次的数字
    // https://leetcode.cn/problems/single-number/description/?envType=study-plan-v2&envId=top-100-liked

    /**
     * 相同的数字进行^操作得到的结果是0
     * @param nums
     * @return
     */
    public int singleNumber(int[] nums) {
        int ret = nums[0];
        for (int i = 1; i < nums.length; i++) {
            ret ^= nums[i];
        }
        return ret;
    }
}
